<?php
/**
 * Created by PhpStorm.
 * User: xujm
 * Date: 2016/8/9
 * Time: 18:55
 */
use Phalcon\Mvc\Controller;
use Phalcon\Mvc\Model\Query;
use Phalcon\Mvc\Model\Manager;


class NavCatController extends Controller {

    public function indexAction()
    {
        $this->view->nav_cat = Navcat::find();

    }

    public function addAction()
    {
        $nav_cat = new Navcat();


        $success = $nav_cat->save(
            $this->request->getPost(),
            array('name','active','remark')
        );
        if ($success) {
            echo "保存成功";
        } else {
            echo "保存失败 ";
            foreach ($nav_cat->getMessages() as $message) {
                echo $message->getMessage(), "<br/>";
            }
        }


    }

    public function editAction()
    {
        $this->view->nav_cat = Navcat::find();
    }

    public function delAction()
    {

    }


}